home *** CD-ROM | disk | FTP | other *** search
/ Developer Helper 1: Phil & Dave's Excellent CD / Excellent CD HFS.raw / Moof / Goodies / HyperCard Goodies / Serial Toolkit / Source Code / sendSPortDone.p < prev    next >
Text File  |  1988-11-18  |  2KB  |  73 lines

  1. (*
  2.     sendSPortDone() -- Returns 'true' if any sending activity on the serial port is completed.
  3.  
  4.     To compile and link this file using Macintosh Programmer's Workshop,
  5.  
  6.         pascal -w sendSPortDone.p
  7.         link -m ENTRYPOINT -o HyperCommands -rt XFCN=7033 -sn Main=sendSPortDone ∂
  8.             sendSPortDone.p.o "{MPW}"Libraries:interface.o
  9.  
  10.     © Copyright 1987,88 by Apple Computer, Inc.
  11.  
  12.     Initial coding 9/87 by Harry R. Chesley.
  13. *)
  14.  
  15. {$R-}
  16.  
  17. {$S sendSPortDone }     { Segment name must be the same as the command name. }
  18.  
  19. unit DummyUnit;
  20.  
  21. interface
  22.  
  23. uses MemTypes, QuickDraw, OSIntf, HyperXCmd;
  24.  
  25. procedure EntryPoint(paramPtr: XCmdPtr);
  26.     
  27. implementation
  28.  
  29. type
  30.  
  31. Str31 = String[31];
  32.  
  33. procedure sendSPortDone(paramPtr: XCmdPtr); forward;
  34.  
  35. procedure EntryPoint(paramPtr: XCmdPtr);
  36.  
  37.     begin
  38.         sendSPortDone(paramPtr);
  39.     end;
  40.  
  41. procedure sendSPortDone(paramPtr: XCmdPtr);
  42.  
  43.     var i: integer;
  44.  
  45.     {$I XCmdGlue.inc}
  46.  
  47.     procedure Fail(errMsg: Str255); { set theResult and quit }
  48.         begin
  49.             paramPtr^.returnValue := PasToZero(errMsg);
  50.             exit(sendSPortDone);
  51.         end;
  52.  
  53.     {$I SPortUtil.inc}
  54.  
  55.     begin
  56.         if paramPtr^.paramCount <> 0 then Fail('parameter count is not 0');
  57.  
  58.         SetUpSPortGlobals;
  59.         EnsureOpenPort;
  60.  
  61.         { Check if all asynchronous activity has finished. }
  62.         for i := 1 to MAXPARMBLKS do
  63.             if ThisSPort.parmBlks[i]^.ioResult > noErr then
  64.                 begin
  65.                     { If not, return false. }
  66.                     paramPtr^.returnValue := PasToZero('false');
  67.                     exit(sendSPortDone);
  68.                 end;
  69.         { If yes, return true. }
  70.         paramPtr^.returnValue := PasToZero('true')
  71.     end;
  72. end.
  73.